home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #11
/
Amiga Plus CD - 2004 - No. 11.iso
/
AmiSoft
/
Gfx
/
show
/
devedie_0.4.lha
/
devedie.c
< prev
next >
Wrap
C/C++ Source or Header
|
2004-06-26
|
7KB
|
247 lines
/* Devedie Custom Application Class*/
#include <exec/types.h>
#include <SDI_compiler.h>
#include <SDI_hook.h>
#include <libraries/mui.h>
#include <clib/alib_protos.h>
#include <proto/asl.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <proto/iffparse.h>
#include <proto/intuition.h>
#include <proto/muimaster.h>
#include <proto/utility.h>
#include <ppcinline/dos.h>
#include <proto/icon.h>
#include <clib/debug_protos.h>
#include "debug.h"
#include "devedie.h"
#include "window.h"
#include "layout_group.h"
extern struct Devedie_Layout layout;
extern APTR window;
struct EmulLibEntry GATE_Devedie_Dispatcher = {SDI_TRAP_LIB, 0, (APTR)Devedie_Dispatcher};
ULONG Devedie_Play(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data = INST_DATA(cl,obj);
ULONG i;
char str[255]={0};
DB(FPrintf(Output(), "Devedie: play method\n"));
sprintf(str,"run %s -dvd %ld -dvd-device %s -alang %s %s %s",
data->mplayer_path,
data->dvd_title,
data->dvd_device,
data->dvd_alang,
(data->dvd_framedrop) ? "-framedrop" : "",
(data->dvd_fullscreen) ? "-fs" : ""
);
DB(FPrintf(Output(), ">%s\n", str));
SystemTagList(str, TAG_DONE);
if (data->dvd_continue)
{
DoMethod(obj, MUIM_Devedie_FewTitle);
}
}
ULONG Devedie_New(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data;
struct TagItem *tags,*tag;
if (!(obj = (Object *)DoSuperMethodA(cl,obj,msg))) return 0;
data = INST_DATA(cl,obj);
data->dvd_title = 1;
data->disk_object = GetDiskObjectNew("PROGDIR:devedie");
if (data->disk_object)
{
set(obj, MUIA_Application_DiskObject, (ULONG)data->disk_object);
data->mplayer_path = FindToolType(data->disk_object->do_ToolTypes, "MPLAYER_PATH");
if (!data->mplayer_path) data->mplayer_path = "sys:apps/mplayer/mplayer";
data->dvd_device = FindToolType(data->disk_object->do_ToolTypes, "DVD_DEVICE");
if (!data->dvd_device) data->dvd_device = "ide.device:1";
data->dvd_framedrop = (ULONG)FindToolType(data->disk_object->do_ToolTypes, "FRAMEDROP");
data->dvd_fullscreen = (ULONG)FindToolType(data->disk_object->do_ToolTypes, "FULLSCREEN");
data->dvd_alang = FindToolType(data->disk_object->do_ToolTypes, "ALANG");
data->dragbar = (ULONG)FindToolType(data->disk_object->do_ToolTypes, "DRAGBAR");
set(window, MUIA_Window_Dragbar, data->dragbar);
if (!data->dvd_alang) data->dvd_alang = "en";
DB(FPrintf(Output(), "ToolTypes:\n"));
DB(FPrintf(Output(), " MPLAYER_PATH %s\n", data->mplayer_path));
DB(FPrintf(Output(), " DVD_DEVICE %s\n", data->dvd_device));
DB(FPrintf(Output(), " AUDIO_LANGUAGE %s\n", data->dvd_alang));
DB(FPrintf(Output(), " FRAMEDROP %lx\n", data->dvd_framedrop));
DB(FPrintf(Output(), " FULLSCREEN %lx\n", data->dvd_fullscreen));
DB(FPrintf(Output(), " DRAGBAR %lx\n", data->dragbar));
}
/* for ( tags=((struct opSet *)msg)->ops_AttrList;
tag=(struct TagItem *)NextTagItem(&tags);)
{
switch (tag->ti_Tag)
{
case 1:
break;
}
}
*/
return (ULONG)obj;
}
ULONG Devedie_Dispose(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data;
ULONG res;
data = INST_DATA(cl,obj);
set(obj, MUIA_Application_DiskObject, 0);
if (data->disk_object) FreeDiskObject(data->disk_object);
res = (ULONG)DoSuperMethodA(cl,obj,msg);
return TRUE;
}
ULONG Devedie_RewTitle(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data= INST_DATA(cl,obj);
ULONG i;
if(data->dvd_title>1)
{
set(layout.lamp[data->dvd_title-1], MUIA_Selected, FALSE);
data->dvd_title--;
set(layout.lamp[data->dvd_title-1], MUIA_Selected, TRUE);
if (data->dvd_continue)
{
for (i=data->dvd_title;i<13;i++)
{
set(layout.lamp[i-1],MUIA_Selected, TRUE);
}
}
}
DB(FPrintf(Output(), "dvd_title is %ld\n", data->dvd_title));
return TRUE;
}
ULONG Devedie_FewTitle(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data = INST_DATA(cl,obj);
ULONG i;
if(data->dvd_title<12)
{
set(layout.lamp[data->dvd_title-1], MUIA_Selected, FALSE);
data->dvd_title++;
set(layout.lamp[data->dvd_title-1], MUIA_Selected, TRUE);
}
DB(FPrintf(Output(), "dvd_title is %ld\n", data->dvd_title));
return TRUE;
}
ULONG Devedie_Set(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data = INST_DATA(cl,obj);
struct TagItem *tags,*tag;
for (tags=((struct opSet *)msg)->ops_AttrList;tag=(struct TagItem *)NextTagItem(&tags);)
{
switch (tag->ti_Tag)
{
case MUIA_Devedie_Continue:
{
ULONG i;
data->dvd_continue = tag->ti_Data;
if (data->dvd_continue)
{
for (i=data->dvd_title;i<13;i++)
{
set(layout.lamp[i-1],MUIA_Selected, TRUE);
}
}
else
{
if (data->dvd_title < 11)
for (i=data->dvd_title+1;i<13;i++)
{
set(layout.lamp[i-1],MUIA_Selected, FALSE);
}
}
}
break;
case MUIA_Devedie_FullScreen:
{
data->dvd_fullscreen = tag->ti_Data;
DB(FPrintf(Output(), "dvd_fullscreen = %lx\n", data->dvd_fullscreen));
}
break;
case MUIA_Devedie_FrameDrop:
{
data->dvd_framedrop = tag->ti_Data;
DB(FPrintf(Output(), "dvd_framedrop = %lx\n", data->dvd_framedrop));
}
break;
}
}
return DoSuperMethodA(cl,obj,msg);
}
ULONG Devedie_Get(struct IClass *cl,Object *obj,Msg msg)
{
struct Devedie_Data *data = INST_DATA(cl,obj);
ULONG *store = ((struct opGet *)msg)->opg_Storage;
switch (((struct opGet *)msg)->opg_AttrID)
{
case MUIA_Devedie_FullScreen:
{
*store = data->dvd_fullscreen;
}
break;
case MUIA_Devedie_FrameDrop:
{
*store = data->dvd_framedrop;
}
break;
}
return DoSuperMethodA(cl,obj,msg);
}
ULONG Devedie_Dispatcher(void)
{
struct IClass *cl=(struct IClass*)REG_A0;
Msg msg=(Msg)REG_A1;
Object *obj=(Object*)REG_A2;
struct Devedie_Data *data = INST_DATA(cl,obj);
switch (msg->MethodID)
{
case MUIM_Devedie_Play: return(Devedie_Play(cl,obj,(APTR)msg));
case OM_NEW : return(Devedie_New(cl,obj,(APTR)msg));
case OM_DISPOSE : return(Devedie_Dispose(cl,obj,(APTR)msg));
case OM_SET : return(Devedie_Set(cl,obj,(APTR)msg));
case OM_GET : return(Devedie_Get(cl,obj,(APTR)msg));
case MUIM_Devedie_RewTitle: return(Devedie_RewTitle(cl,obj,(APTR)msg));
case MUIM_Devedie_FewTitle: return(Devedie_FewTitle(cl,obj,(APTR)msg));
}
return DoSuperMethodA(cl,obj,msg);
}